<template>
  <view>
    <basics v-if="PageCur=='basics'"></basics>
    <components v-if="PageCur=='component'"></components>
    <user v-if="PageCur=='user'"></user>
    <!-- 自定义底部 -->
    <view class="cu-bar tabbar bg-white shadow foot">
      <view class="action" @click="NavChange" data-cur="basics">
        <view class='cuIcon-cu-image'>
          <image :src="'/static/tabbar/basics' + [PageCur=='basics'?'_cur':''] + '.png'"></image>
        </view>
        <view :class="PageCur=='basics'?'text-green':'text-gray'">服务</view>
      </view>
      <view class="action" @click="NavChange" data-cur="component">
        <view class='cuIcon-cu-image'>
          <image :src="'/static/tabbar/component' + [PageCur == 'component'?'_cur':''] + '.png'"></image>
        </view>
        <view :class="PageCur=='component'?'text-green':'text-gray'">日程</view>
      </view>
      <view class="action" @click="NavChange" data-cur="user">
        <view class='cuIcon-cu-image'>
          <image :src="'/static/tabbar/user' + [PageCur=='user'?'_cur':''] + '.png'"></image>
        </view>
        <view :class="PageCur=='user'?'text-green':'text-gray'">我的</view>
      </view>
    </view>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        PageCur: 'basics' // 初始化选中页
      }
    },
    onLoad(e) {
      if (e.path) {
        this.PageCur = e.path
      }
    },
    onShow() {
      uni.setStorageSync('yuyue', {})
      uni.setStorageSync('setYuyue', {})
      // let that = this;
      // uni.getStorage({
      //   key: 'openid',
      //   success: (res) => {
      //   },
      //   fail: () => {
      //     uni.navigateTo({
      //       url: '/pagesA/login/login'
      //     })
      //   }
      // });
    },
    methods: {
      NavChange: function(e) {
        this.PageCur = e.currentTarget.dataset.cur
      }
    },
  }
</script>

<style>

</style>
